﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


using XT.Exam.Factory;
using XT.Exam.IBLL;
using XT.Exam.IDataAccess;
using System.Linq.Expressions;
using System.Data.SqlClient;
using XT.Exam.IBLL.BaseInterface;
using XT.Exam.IDataAccess.Base_Inerface;
namespace XT.Exam.BLL.BaseClass
{
    public abstract class BaseBuisnessLogic<D, T> : IBaseBusinessLogic<D, T>
        where D : IBaseDataAccess<T>
        where T : class
    {
        public abstract string DataAccessfullName { get; }

        protected readonly D dal;
        public BaseBuisnessLogic()
        {
            dal = AbstractFactory<D>.CreateDataAccess(DataAccessfullName);
        }


        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool Add(T t,params SqlParameter[] parameter)
        {
            return dal.Add(t,parameter);
        }
        public bool DeleteById(T t)
        {
            return dal.DeleteById(t);
        }
        public bool Update(T t)
        {
            return dal.Update(t);
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public List<T> GetList<T>(params SqlParameter[] param) where T : new()
        {
            return dal.GetList<T>(param);
        }

    }
}
